package net.chromedpork.scraper;



import net.chromedpork.hypertext.validation.Assertion;



/**
 *
 *  Scraper object factory.
 * 
 *  @author Inode <inode@chromedpork.net>
 *
 */

public class ScraperFactory
{
    /**
     *
     *  Fabricates a scraper object from a configuration document.
     *
     *  @param config   XML configuration document filename
     *
     *  @return scraper object
     *
     *  @throws ScraperException
     *
     */

    public static Scraper getScraper(String config)
           throws ScraperException
    {
        Assertion.notNull(config, "configuration filename is null");

        return (new Scraper(config));
    }



    /**
     *
     *  Fabricates a scraper object from a configuration document,
     *  with arguments.
     *
     *  @param config   XML configuration document filename
     *
     *  @return scraper object
     *
     *  @throws ScraperException
     *
     */

    public static Scraper getScraper(String config, String... arguments)
           throws ScraperException
    {
        Assertion.notNull(config, "configuration filename is null");
        Assertion.notNull(arguments, "arguments array is null");
        Assertion.notNegativeNorZero(arguments.length, "bad argument count");

        return (new Scraper(config, arguments));
    }
}
